<?php

namespace Admin\Controller;

class SetController extends BaseController
{
  /**
   * 分销设置
   */
  public function index()
  {
    $set = M("Setting");
    $setting = $set->where("id=1")->select();
    $action = $set->where("id=1")->getField('switch');
    $this->assign('setting',$setting);
    $this->assign('action',$action);
    $this->display();

  }

  public function done()
  {
    $set = M("Setting");
    $data['scale_one'] =I("post.scale_one");
    $data['scale_two'] =I("post.scale_two");
    $data['switch'] =I("post.switch");
    $res = $set->where("id=1")->save($data);
    if ($res) {
      $this->success('设置成功', U('Set/index'));
    } else {
      $this->success('未做任何更改', U("Set/index"));
    }

  }


}


